About 1334 letters

About 7 minutes

#max

Description: Get the maximum value. See also the min function.

def max(iterable, *, key=None):
    '''
    Get the maximum value

    :param iterable: An iterable object
    :param key: A callback function returning the value to compare
    :return: The maximum value in the iterable
    '''

def max(iterable, *, default, key=None):
    '''
    Get the maximum value

    :param iterable: An iterable object
    :param default: Default value returned if the iterable is empty
    :param key: A callback function returning the value to compare
    :return: The maximum value in the iterable
    '''

def max(arg1, arg2, *args, key=None):
    '''
    Get the maximum value

    :param arg1: A value
    :param arg2: A value
    :param args: Any number of values
    :param key: A callback function returning the value to compare
    :return: The maximum value
    '''

Example:

print(max(2, 8, 4, 3, 9, 1, 6, 5, 7))
print(max([2, 8, 4, 3, 9, 1, 6, 5, 7]))
print(max([], default=-1))
print(max([('Tom', 8), ('Jerry', 9), ('Spike', 5), ('Tuffy', 3)], key=lambda x:x[1]))

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

Updated: 6/9/2025

Author: PlanC

Created: 6/9/2025